using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using JobShopModel.GraphicInterface;
using JobShopModel.Model;
using JobShopModel.Model.FactoryLvl;

namespace JobShopModel.GraphicInterface
{
    public partial class StatisticsDisplay : Form
    {
        public StatisticsDisplay()
        {
            InitializeComponent();
        }

        // private void StatisticsDisplay_Load(object sender, EventArgs e)
        public void UpdateGUI(Statistics stats)
        {

            this.textBox4.Text = Factory.getInstance().CurrentTime.ToString();

            this.transUtilTextBox.Text = string.Format("{0:0.##} %", stats.TranspUtil) ;
            this.transTimeTextBox.Text = stats.TranspTime.ToString();
            this.textBox5.Text = stats.NumTransp.ToString();
            this.textBox9.Text = string.Format("{0:0.##} %",stats.SimProgress*100);

            this.jobQueueDelayTextBox1.Text = stats.getJobQueueDelay(0).ToString();
            this.jobQueueDelayTextBox2.Text = stats.getJobQueueDelay(1).ToString();
            this.jobQueueDelayTextBox3.Text = stats.getJobQueueDelay(2).ToString();

           /* this.jobTransDelayTextBox1.Text = stats.getJobTransDelay(0).ToString();
            this.jobTransDelayTextBox2.Text = stats.getJobTransDelay(1).ToString();
            this.jobTransDelayTextBox3.Text = stats.getJobTransDelay(2).ToString();
            */
            this.textBox1.Text = stats.getJobFifoDelay(0).ToString();
            this.textBox2.Text = stats.getJobFifoDelay(1).ToString();
            this.textBox3.Text = stats.getJobFifoDelay(2).ToString();

            this.textBox6.Text = stats.NumOperation[2].ToString();
            this.textBox7.Text = stats.NumOperation[1].ToString();
            this.textBox8.Text = stats.NumOperation[0].ToString();

            this.textBox16.Text = stats.JobCreatedCounter[0].ToString();
            this.textBox15.Text = stats.JobCreatedCounter[1].ToString();
            this.textBox14.Text = stats.JobCreatedCounter[2].ToString();


            
            this.machWorkingTextBox1.Text = string.Format("{0:0.##} %",stats.getMachWorking(0)*100);
            this.machWorkingTextBox2.Text = string.Format("{0:0.##} %",stats.getMachWorking(1)*100);
            this.machWorkingTextBox3.Text = string.Format("{0:0.##} %",stats.getMachWorking(2)*100);
            this.machWorkingTextBox4.Text = string.Format("{0:0.##} %",stats.getMachWorking(3)*100);
            this.machWorkingTextBox5.Text = string.Format("{0:0.##} %",stats.getMachWorking(4)*100);

            this.machBlockedTextBox1.Text = string.Format("{0:0.##} %",stats.getMachBlocked(0)*100);
            this.machBlockedTextBox2.Text = string.Format("{0:0.##} %",stats.getMachBlocked(1)*100);
            this.machBlockedTextBox3.Text = string.Format("{0:0.##} %",stats.getMachBlocked(2)*100);
            this.machBlockedTextBox4.Text = string.Format("{0:0.##} %",stats.getMachBlocked(3)*100);
            this.machBlockedTextBox5.Text = string.Format("{0:0.##} %",stats.getMachBlocked(4)*100);

            this.machIdleTextBox1.Text = string.Format("{0:0.##} %",stats.getMachIdle(0)*100);
            this.machIdleTextBox2.Text = string.Format("{0:0.##} %",stats.getMachIdle(1)*100);
            this.machIdleTextBox3.Text = string.Format("{0:0.##} %",stats.getMachIdle(2)*100);
            this.machIdleTextBox4.Text = string.Format("{0:0.##} %",stats.getMachIdle(3)*100);
            this.machIdleTextBox5.Text = string.Format("{0:0.##} %",stats.getMachIdle(4)*100);

            this.machNumQueueTextBox1.Text = stats.getMachNumQueue(0).ToString();
            this.machNumQueueTextBox2.Text = stats.getMachNumQueue(1).ToString();
            this.machNumQueueTextBox3.Text = stats.getMachNumQueue(2).ToString();
            this.machNumQueueTextBox4.Text = stats.getMachNumQueue(3).ToString();
            this.machNumQueueTextBox5.Text = stats.getMachNumQueue(4).ToString();

            this.machQueueDelayTextBox1.Text = stats.getMachQueueDelay(0).ToString();
            this.machQueueDelayTextBox2.Text = stats.getMachQueueDelay(1).ToString();
            this.machQueueDelayTextBox3.Text = stats.getMachQueueDelay(2).ToString();
            this.machQueueDelayTextBox4.Text = stats.getMachQueueDelay(3).ToString();
            this.machQueueDelayTextBox5.Text = stats.getMachQueueDelay(4).ToString();

            this.textBox13.Text = stats.NumOperation[0].ToString();
            this.Opst2.Text = stats.NumOperation[1].ToString();
            this.opst3.Text = stats.NumOperation[2].ToString();
            this.opst4.Text = stats.NumOperation[3].ToString();
            this.opst5.Text = stats.NumOperation[4].ToString();
        }


    }
}
